Java opencsv-use Spring's PostConstruct mechanism to read the CSV configuration file to the memory map at project startup
A. studentconfig.csv file:
ID, NAME, SCORE1, Zhang San, 1002, Li Si, 903, Zhao Wu, 604, Wang Liu, 55
Ii.
Sample.csv file:
COUNTRY,CAPITAL,POPULATIONIndia,New Delhi, 1.21BPeople's republic of China,Beijing, 1.34BUnited States,Washington D.C., 0.31B
1. Use readNext () to read CSV files in a row and return a String Array
package
First understand what the CSV file looks for:
Open in Excel becomes a table, you can not see the details
It is recommended to use other simple and crude editors, such as notepad++,
The contents of the CSV file are as follows:
Recently, there was a requirement in the work to export CSV format files, before encountering similar requirements, finally found on Google Opencsv, and provide Java API
Opencsv Address: https://code.google.com/p/opencsv/
The site provides a
Opencsv is a simple Java class library for parsing CSV files that encapsulates the output and reading of CSV format files, automates the processing of special characters in CSV format, and most importantly opencsv can be used for commercialization
Opencsv
Java read CSV Class library There are two main, opencsv and javacsv, the study found that javacsv last update is 2014-12-10, a long time does not maintain. Opencsv is an Apache project and is still being maintained, so decided to use
My platform:
Mac OS X Lion 10.7.2
Some things are used:
0. IExplorer. app
Export the sqlite database file that saves the chat data to your computer,
The location of the database is (the QQ number is blurred ):
Export the db file to your
With the release of the project, the project is currently idle, so you can take the team to summarize and extract the components, tools, and practices that have been done well in this year's project, I will release it later. Today, it is mainly a
This article introduces java File Read and Write instances, including saving remote files to this address and reading and writing csv files. If you are interested, refer.
File file = new File ("http: // 127.0.0.1: 8080/aa.txt") cannot be used
File file = new File ("http: // 127.0.0.1: 8080/aa.txt") cannot be used directly for reading, because the transmission protocol on the network is HTTP, which is different from that on the local machine, use URL to read The code is as follows:Copy
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.